
layui.use('form', function(){
    var form = layui.form,
        $ = layui.jquery;

    //监听提交
    form.on('submit(addAPI)', function(data){
        console.log(data.field);
        $.ajax({
            url : "../apiInfo/update",
            type : "get",
            data:data.field,
            dataType : "json",
            scriptCharset: 'utf-8',
            success : function(data){
                if(!data.success){
                    layer.msg("操作失败！请联系管理员:咚咚shaoyu1");
                }else{
                    layer.msg("操作成功！");
                }
                layer.closeAll("iframe");
                //刷新父页面
                parent.location.reload();
            }
        })
        return false;
    });

});